const mongoose = require("mongoose");
const crypto = require("crypto");

mongoose.connect("mongodb://localhost:27017/instant");

const db = mongoose.connection;

db.once("open",function(){
   console.log("数据库连接成功");
});

var User = mongoose.model("t_user", mongoose.Schema({
    username : String,
    password : String,
    create_time : Date,
    last_login : Date
}));

const hashPwd = crypto.createHash("md5");
hashPwd.update("12345");

var user1 = new User({
    username:"Admin",
    password:hashPwd.digest("hex"),
    create_time : new Date(),
    last_login:null
});
user1.save();